package com.ruoyi.biz.service.casepahse.impl;

import org.springframework.stereotype.Service;

import com.ruoyi.biz.bean.bo.CasePhaseBO;
import com.ruoyi.biz.bean.vo.qo.CasePhaseQO;
import com.ruoyi.biz.domain.CasePhase;
import com.ruoyi.biz.mapper.CasePhaseMapper;
import com.ruoyi.biz.service.casepahse.ICasePhaseService;
import com.ruoyi.comm.crud.service.impl.BaseBQImpls;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.utils.StringUtils;

/**
 * 案件类型信息 服务层处理
 * 
 * @author riverbo
 */
@Service
public class CasePhaseServiceImpl extends BaseBQImpls<CasePhaseMapper, CasePhase, CasePhaseBO, CasePhaseQO> implements ICasePhaseService {

	@Override
	public Boolean checkNameUnique(CasePhase t) {
        Long boId = StringUtils.isNull(t.getCasePhaseId()) ? -1L : t.getCasePhaseId();
        Long dbId = this.baseMapper.getIdByName(t);
        if (StringUtils.isNotNull(dbId) && dbId.longValue() != boId.longValue()) {
            return UserConstants.NOT_UNIQUE;
        }
        return UserConstants.UNIQUE;
	}

}
